package ${controllerPackageName};

import ${apiPackageName}.${domain.className}Api;
import ${domianPackageName}.${domain.className};
import ${servicePackageName}.${domain.className}Service;
import com.platform.common.domain.result.ParameterDataStruct;
import com.platform.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
* ${(domain.comment)!} controller
*
* @author: ${domain.author}
* @version: 1.0
* @datetime: ${domain.datetime}
*/
@RestController
public class ${domain.className}ApiImpl implements ${domain.className}Api {

    @Autowired
    private ${domain.className}Service ${domain.lowerStartClassName}Service;

    @Override
    public void save(@RequestBody ${domain.className} ${domain.lowerStartClassName}) throws Exception {
        ${domain.lowerStartClassName}Service.save(${domain.lowerStartClassName});
    }

    @Override
    public void modify(@RequestBody ${domain.className} ${domain.lowerStartClassName}) throws Exception {
        ${domain.lowerStartClassName}Service.modify(${domain.lowerStartClassName});
    }

    @Override
    public void remove(@RequestBody ${domain.className} ${domain.lowerStartClassName}) throws Exception {
        ${domain.lowerStartClassName}Service.remove(${domain.lowerStartClassName});
    }

    @Override
    public void resort(@RequestBody ${domain.className} ${domain.lowerStartClassName}) throws Exception {
        ${domain.lowerStartClassName}Service.resort(${domain.lowerStartClassName});
    }

    @Override
    public ${domain.className} findById(@RequestBody ${domain.className} ${domain.lowerStartClassName}) throws Exception {
    <#list domain.keys as item>
        return ${domain.lowerStartClassName}Service.findById(${domain.lowerStartClassName}.get${item.upperStartName}());
    </#list>
    }

    @Override
    public List<${domain.className}> find(@RequestBody ${domain.className} ${domain.lowerStartClassName}) throws Exception {
        return ${domain.lowerStartClassName}Service.find(${domain.lowerStartClassName});
    }

    @Override
    public PageInfo<${domain.className}> findPage(@RequestBody ParameterDataStruct<${domain.className}> parameterDataStruct) throws Exception {
        return ${domain.lowerStartClassName}Service.findPage(parameterDataStruct.getData(), parameterDataStruct.getPageTo());
     }
}
